package spaces;

import vectors.Location;
import vectors.Vector;

public class VectorNode extends Node implements Comparable<VectorNode>{
	
	public VectorNode(String name){
		super(name);
	}
	
	public VectorNode(String name, Vector pos){
		super(name, pos);
	}

	public Vector getPos(){
		return (Vector)location;
	}
	
	public void setPos(Vector dir){
		location = dir;
	}
	
	@Override
	public Vector getLocation() {
		return (Vector)location;
	}

	@Override
	public void setLocation(Location location) {
		if(location instanceof Vector){
			this.location = location;
		} else {
			throw new IllegalArgumentException("Must give Direction, not any Location.");
		}
	}
	
	@Override
	public int compareTo(VectorNode node) {
		return name.compareTo(node.getName());
	}
	
	public boolean equals(Object node){
		if(node instanceof VectorNode){
			return compareTo((VectorNode)node) == 0;
		} else {
			return super.equals(node);
		}
	}
}
